package com.web.manager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.web.manager.pojo.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper extends BaseMapper<User>{  //BaseMapper中继承了Mapper，里面有大量增删改查的方法

/*
    @Insert("insert into manager_user (username, name,password, gender, phone, email,role,img) " +
            "value (#{username},#{name},#{password},#{gender},#{phone},#{email},#{role},#{img})")
    void Insert(User user);


    @Update("update manager_user set username=#{username},name = #{name}," +
            "password=#{password},gender=#{gender},phone=#{phone},email=#{email},img=#{img},role=#{role} where id = #{id}")
    void updateUser(User user);


    @Delete("delete from manager_user where id=#{id}")
    void deleteUser(Integer id);


    @Select("select * from manager_user  ")
    List<User> selectAll();

    //根据id查询
    @Select("select * from manager_user where id = #{id} order by id")
    User selectById(Integer id);



    @Select("select * from manager_user where username like concat('%', #{username}, '%') and name like concat('%', #{name}, '%') order by id desc limit #{skipNum}, #{pageSize}")
    List<User> selectByPage(@Param("skipNum") Integer skipNum, @Param("pageSize")Integer pageSize, @Param("username") String username, @Param("name") String name);


    @Select("select count(id) from manager_user where username like concat('%', #{username}, '%') and name like concat('%', #{name}, '%') order by id desc")
    int selectCountByPage(@Param("username") String username, @Param("name") String name);


    @Select("select * from manager_user where username = #{username} order by id desc")
    User selectByUsername(String username);
 */





}
